<!DOCTYPE HTML>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head th:include="include :: head('业务日志列表')"></head>
<body>
<div class="yadmin-body animated fadeIn">
    <div class="layui-form yadmin-search-area input">
        <form class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">时间范围</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="search-time" placeholder="开始 到 结束" />
                </div>
                 <button lay-submit="" lay-filter="search" class="layui-btn layui-btn-sm layui-btn-primary table-action">
                    <i class="layui-icon layui-icon-search"></i>
                </button>
                <button type="reset" lay-filter="search" class="layui-btn layui-btn-sm layui-btn-primary table-action">
                    <i class="layui-icon layui-icon-refresh"></i>
                </button>
            </div>
        </form>
    </div>
    <table class="layui-hide" id="table-list"></table>
</div>
<script>
layui.use(['table', 'form', 'laydate'], function () {
    let table = layui.table, form = layui.form, laydate = layui.laydate;
    laydate.render({
        elem: '#search-time',
        type: 'datetime',
        range: '到',
        format: 'yyyy-M-d'
    });
    table.render({
        elem: '#table-list',
        url: '/log/list',
        method: 'post',
        dataType: 'JSON',
        page: true,
        cols: [
            [
                {type: 'checkbox'},
                {field: 'logType', title: '类型', minWidth: 80},
                {field: 'className', title: '类名', minWidth: 80},
                {field: 'method', title: '方法名', minWidth: 80},
                {field: 'createTime', title: '时间', minWidth: 80},
                {field: 'message', title: '具体消息', minWidth: 80},
            ]
        ], parseData: function (res) { //res 即为原始返回的数据
            return {
                "code": res.code, //解析接口状态
                "msg": res.msg, //解析提示文本
                "data": res.data, //解析数据列表
                "count": res.recordsTotal
            };
        }
    });
    form.on('submit(search)', function (form) {
        table.reload('table-list', {
            where: form.field
        });
        return false;
    });
});
</script>
</body>
</html>